package com.westar.core.dao;

import com.westar.base.model.Area;
import com.westar.base.model.Implement;
import com.westar.base.model.ImplementDetail;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;

@Repository
public class ImplementDao extends BaseDao {
    /**
     * 树形查找区域信息
     * @param implementId 部门主键
     * @return
     */
    public List<Implement> listTreeImplement(Integer implementId) {
        StringBuffer sql = new StringBuffer();
        List<Object> args = new ArrayList<Object>();
        sql.append("\n select * from implement where 1=1");
        sql.append("\n start with parentId="+implementId+" CONNECT BY PRIOR implementId = parentId");
        sql.append("\n order siblings by implementId ");
        return this.listQuery(sql.toString(), args.toArray(), Implement.class);
    }

}
